import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FishSiteVO, FishSiteForm, FishSiteQuery } from '@/api/fishSite/fishSite/types';

/**
 * 查询钓场列表
 * @param query
 * @returns {*}
 */

export const listFishSite = (query?: FishSiteQuery): AxiosPromise<FishSiteVO[]> => {
  return request({
    url: '/fishSite/fishSite/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询钓场详细
 * @param fishSiteId
 */
export const getFishSite = (fishSiteId: string | number): AxiosPromise<FishSiteVO> => {
  return request({
    url: '/fishSite/fishSite/' + fishSiteId,
    method: 'get'
  });
};

/**
 * 新增钓场
 * @param data
 */
export const addFishSite = (data: FishSiteForm) => {
  return request({
    url: '/fishSite/fishSite',
    method: 'post',
    data: data
  });
};

/**
 * 修改钓场
 * @param data
 */
export const updateFishSite = (data: FishSiteForm) => {
  return request({
    url: '/fishSite/fishSite',
    method: 'put',
    data: data
  });
};

/**
 * 删除钓场
 * @param fishSiteId
 */
export const delFishSite = (fishSiteId: string | number | Array<string | number>) => {
  return request({
    url: '/fishSite/fishSite/' + fishSiteId,
    method: 'delete'
  });
};
